package com.cfswt.tasksystem.mapper;

import com.cfswt.tasksystem.pojo.dto.MaterialDTO;
import com.cfswt.tasksystem.pojo.dto.OutboundMaterialDTO;
import com.cfswt.tasksystem.pojo.dto.WarehousingMaterialDTO;
import com.cfswt.tasksystem.pojo.entity.Code;
import com.cfswt.tasksystem.pojo.entity.Material;
import com.cfswt.tasksystem.pojo.vo.*;
import org.apache.ibatis.annotations.Mapper;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface MaterialMapper {
    // 使用NewMaterialDTO增加Material
    int addNewMaterial(Material material);

    // 申请入库
    int applyWarehousing(WarehousingMaterialDTO warehousingMaterialDTO);

    //查询质量验收阶段申请单数据
    List<QualifyWarehousingVO> selectQualifyWareHousingById(String processId);

    //入库验收人添加字段
    int updateQualifiedhousingById(WarehousingMaterialDTO warehousingMaterialDTO);

    // 审核入库单
    List<ReviewWarehousingVO> selectApplyWareHousingById(String processId);

    //入库保管人添加字段
    int updateCustodianhousingById(WarehousingMaterialDTO warehousingMaterialDTO);

    //入库物资审核完成进行数据更新
    int updateMaterialByCode(Material material);

    //查询数据打印入库单
    List<PrintWarehousingVO> selectPrintWareHousingById(String processInstanceId);

    // 查询所有Material，返回MaterialVO列表
    List<MaterialVO> selectAllMaterialVOs();

    //通过前端的code数组（对象数组）查询要对应的出库数据
    List<ApplyOutboundVO> selectApplyOutboundByCodes(List<Code> codes);
    //通过code查询对应出库信息
    ApplyOutboundVO selectApplyOutboundByCode(String code);

    //申请出库
    int applyOutbound(OutboundMaterialDTO outboundMaterialDTO);


    // 审核出库单
    List<OutboundMaterialDTO> selectApplyOutboundById(String processId);

    //出库物资审核完成进行数据更新
    int updateReviewOutboundById(OutboundMaterialDTO outboundMaterialDTO);

    //出库物资制造部部长审核完后更新保管员字段
    int updateCustodianOutboundById(OutboundMaterialDTO outboundMaterialDTO);

    //查询数据打印出库单
    List<PrintOutboundVO> selectPrintOutboundById(String processInstanceId);

    int updateMaterialStockByCodeAndNumber(String code, int number);

    int selectStockNumberBycode(String code);

    List<MaterialRecordVO> selectMaterialRecordByCode(String code);

    int updateMaterialItem(MaterialDTO materialDTO);

    List<MaterialProcessVO> selectWarehousingProcessVO(String userName);

    List<MaterialProcessVO> selectOutboundProcessVO(String userName);

    List<MaterialProcessVO> selectAllWarehousingProcessVO();

    List<MaterialProcessVO> selectAllOutboundProcessVO();

    Integer countWarehousingByDate(LocalDate date);

    Integer countOutboundByDate(LocalDate date);

    int updateWarehousingStatus(String serialNumber, String status);

    int updateOutboundStatus(String serialNumber, String status);

    int deleteOutboundItemById(Integer id);

    int updateOutboundItem(OutboundMaterialDTO outboundMaterialDTO);


}
